package cheme.ProcessModel.Cmds;

import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;

import cheme.ProcessModel.ITranslatable;

public class ChangeLocationCmd extends Command
{
	private ITranslatable element;

	private Point newLocation;

	private Point oldLocation;
	
	public ChangeLocationCmd(ITranslatable model, Point newLocation)
	{
		element = model;
		this.newLocation = newLocation;
	}

	public void execute()
	{
		oldLocation = element.getLocation();
		element.setLocation(newLocation);
	}
	
	@Override
	public void redo()
	{
		element.setLocation(newLocation);
	}

	public void undo()
	{
		element.setLocation(oldLocation);
	}
}
